package com.txzn.common.config.common.config;

import javax.servlet.http.HttpServletRequest;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.jfinal.core.Controller;

public class BasePathInterceptor implements Interceptor {

	@Override
	public void intercept(Invocation inv) {
		
		Controller co = inv.getController();
		HttpServletRequest req = co.getRequest();
		//request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
		String basePath = req.getScheme()+"://"+req.getServerName()+":"+req.getServerPort()+"/"+req.getContextPath();//PathKit.getWebRootPath();
		co.setAttr("basePath", basePath);
		inv.invoke();
		
	}

}
